双系统时差问题

Linux 默认把 RTC 时间当作 UTC 时间,而 Windows 默认把 RTC 时间当作本地时间。

因此解决办法就是把 Linux 的 RTC 时间设为本地时间,或者把 Windows 的 RTC 时间设为 UTC 时间。

把 Linux 的 RTC 时间设为本地时间的命令为:

1timedatectl set-local-rtc 1

这么做会产生一个警告:

1Warning: The system is configured to read the RTC time in the local time zone.
2         This mode cannot be fully supported. It will create various problems
3         with time zone changes and daylight saving time adjustments. The RTC
4         time is never updated, it relies on external facilities to maintain it.
5         If at all possible, use RTC in UTC by calling
6         'timedatectl set-local-rtc 0'.

把 Windows 的 RTC 时间设为 UTC 时间的命令为:

1Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1